import { Link } from '@brillout/docpress'

**Environment**: server.

We install Telefunc by using Telefunc's server middleware `telefunc()`:

```ts
// server.ts

// Server (Express.js/Fastify/...)

import { telefunc } from 'telefunc'

// Telefunc middleware
app.all('/_telefunc', async (req: Request, res: Response) => {
  const httpResponse = await telefunc({
    // HTTP Request URL, which is '/_telefunc' if we didn't modify config.telefuncUrl
    url: req.url,
    // HTTP Request Method (GET, POST, ...)
    method: req.method,
    // HTTP Request Body, which can be a string, buffer, or stream
    body: req.body,
    // Optional
    context: {
      /* Some context */
    }
  })
  const { body, statusCode, contentType } = httpResponse
  res.status(statusCode).type(contentType).send(body)
})
```

The `context` parameter is optional and is only needed if we use `getContext()`, see <Link href="/getContext#provide" />.
